package com.yifeng.repo.base.params;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Created by daibing on 2024/1/30.
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class BizCacheParam {

    /**
     * 是否启用本地缓存
     */
    private boolean enableLocalCache = false;

    /**
     * 本地缓存最大值
     */
    private long localMaximumSize = 2048;

    /**
     * 本地缓存保持时间
     */
    private long localDurationSeconds = 180;

    /**
     * redis key 前缀，如果不配置默认使用appId
     */
    private String redisKeyPrefix;

    /**
     * redis://[:password]@host:port/db
     */
    private String jedisUri = "redis://:123456@127.0.0.1:6379/0";
    private int jedisMaxTotal = 8;
    private int jedisMaxIdle = 8;
    private int jedisMinIdle = 0;
    private int jedisMaxWaitMillis = 1500;
    private boolean jedisBlockWhenExhausted = false;
    private boolean jedisTestOnBorrow = true;

    public BizCacheParam(String appId) {
        this.redisKeyPrefix = appId;
    }
}
